import logo from './logo.svg';
import React, { useState } from 'react';
import './App.css';
import { Route, Routes, Link, NavLink, Navigate, useNavigate, useLocation } from 'react-router-dom'
import Home from './views/Home';
import Reg from './views/Reg';
import Login from './views/Login';
import Searchs from './views/Searchs'
import Class from './views/Class'
import Detail from './views/Detail'
import request from './utils/request';
import 'antd/dist/antd.css';
import Findpass from './views/user/Findpass';
import Passemail from './views/user/Passemail';
import Index from './views/user/Index';
import Upgrade from './views/user/index/Upgrade';
import Forum from './views/discuss/Forum';
import Course from './views/detail/course/Course';
import Play from './views/home/Play';
import 'antd/dist/antd.min.css';
import Tab from './views/class/contxts/index'
import { item, diqu, toubu, diqu1 } from './views/class/saixuan'
import './views/class/yangshi.scss'
import { Input } from 'antd';


function App() {
  const { Search } = Input
  const navigate = useNavigate()
  const [toubu2, settoubu] = useState(toubu())
  const [tages, setTages] = useState('')
  const nuber2 = 20
  const onSearch = (e) => {
    // console.log(e);
    navigate('/search/?kw=' + e)
  }
  const toClass = (e) => {
    // console.log(e);
    if (e == '首页') {
      navigate('/home')
      return
    }
    setTages(e)
    navigate('/class/' + e)
  }
  return (

    <div className="App">
      <nav className="navbar navbar-inverse navbar-fixed-top">
        <Search placeholder="搜索你喜欢的影片、演员、导演" enterButton onSearch={onSearch}
          style={{
            width: '200px',
            position: 'absolute',
            left: '20px',
            top: '10px'
          }} />
        <div className="navbar-text ">
          <Tab shuzhu={toubu2.toubu} centered2='false' onChange2={toClass} tabBarGutter2={nuber2} />
          <span className="span-1">|</span>
          <span onClick={() => {
            navigate('/user/index/information')
          }} className="glyphicon glyphicon-user span-2"></span>
        </div>
      </nav>
      <Routes>

        <Route path='user/findpass' element={<Findpass />}></Route>
        <Route path='user/passemail' element={<Passemail />}></Route>
        <Route path='user/index/*' element={<Index />}></Route>
        <Route path='/login' element={<Login />}></Route>
        <Route path='/home' element={<Home />}></Route>
        <Route path="/" element={<Navigate to="/home" />} />
        <Route path='/reg' element={<Reg />}></Route>
        <Route path='/search' element={<Searchs />}></Route>
        <Route path='/class/*' element={<Class tages={tages} />}></Route>
        <Route path='/detail/*' element={<Detail />}></Route>
        <Route path='/upgrade' element={<Upgrade />}></Route>
        <Route path='/qiupian' element={<Forum />}></Route>
        <Route path='/course' element={<Course />}></Route>
        {/* <Route path="/play" element={<Play />}></Route> */}
      </Routes>
    </div>
  );
}
export default App;
